package com.app.web.controller.app;/**
 * @program: app-admin
 * @name AppUserController
 * @description: app用户信息
 */

import com.app.common.core.controller.AppBaseController;
import com.app.common.core.domain.ApiResult;
import com.app.system.domain.AppUser;
import com.app.system.domain.vo.AppUserEditVo;
import com.app.system.service.IAppUserService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 *@author:
 *@program: app-admin
 *@name AppUserController
 *@description: app用户信息
 */
@Slf4j
@Api(value = "APP用户信息", tags = {"APP用户信息接口"})
@RestController
@RequestMapping("/app/user")
public class AppUserController extends AppBaseController {

    @Resource
    private IAppUserService appUserService;

    /**
     * @param appUser
     * @return {@link ApiResult}<{@link List}<{@link AppUser}>>
     */
    @ApiOperation("查询APP用户信息列表")
    @GetMapping("/list")
    public ApiResult<List<AppUser>> list(AppUser appUser) {
        startPage();
        List<AppUser> list = appUserService.selectAppUserList(appUser);
        return ApiResult.page(list, new PageInfo(list).getTotal());
    }

    /**
     * 修改app用户信息
     * @param editVo
     * @return {@link ApiResult}<{@link Integer}>
     */
    @ApiOperation("修改APP用户信息")
    @PostMapping("/edit")
    public ApiResult<Integer> edit(@Valid @RequestBody AppUserEditVo editVo){
        return ApiResult.toR(appUserService.updateAppUser(editVo));
    }
}
